<template>
  <div>
    <Button v-on:click="refresh">fsd</Button>
    <yfu-table :param="tableparam" v-on:getCheckedRows="getRows" ref="demoTable"></yfu-table>
  </div>
</template>
<script type="text/javascript">
  import yfuTable from '@/components/common/yfuTable.vue'
  import { getOrganizationList } from '@/view/api/organization.js'
  export default {
    components: {
      'yfu-table': yfuTable
    },
    methods: {
      // 得到所有选中行
      getRows (row) {
        console.log(row)
      },
      refresh () {
        this.$refs.demoTable.refreshTable()
      }
    },
    data () {
      return {
        tableparam: {
          showBox: true,
          baseURL: process.env.BASE_API,
          url: getOrganizationList.url,
          urlParam: {
            organizaitonId: 1
          },
          showSearch: true,
          searchWidth: '300px',
          searchRows: [
            {
              label: '用户名',
              value: 'username'
            }, {
              label: '真实姓名',
              value: 'namezs'
            }
          ],
          operateRow: {
            width: '200px'
          },
          showOperateRow: true,
          operateButtons: [
            {
              operateFunction: function (row) {
                console.log('rows' + row)
              },
              icon: 'people_list',
              permission: 'fmRoleDelete'
            },
            {
              operateFunction: function (row) {
                console.log('rows' + row)
              },
              icon: 'people_list',
              permission: 'fmRoleDelete'
            },
            {
              operateFunction: function (row) {
                console.log('rows' + row)
              },
              icon: 'people_list',
              permission: 'fmRoleDelete1'
            }
          ],
          rows: [
            {
              prop: 'name',
              label: '姓名',
              width: '100px'
            },
            {
              prop: 'namezs',
              label: '真空姓名',
              width: '100px'
            },
            {
              prop: 'status',
              label: '状态',
              formatter: function (row, column) {
                if (row.status === 0) {
                  return '已禁用'
                } else if (row.status === 1) {
                  return '已启用'
                } else {
                  return '未知'
                }
              }
            }
          ]
        }
      }
    }
  }
</script>
<style>
</style>
